package tools

import (
	. "go-caipu/pkg/services/sqlstore/migrator"
)

func AddSysToolsColumnMigrations(mg *Migrator) {
	userV1 := Table{
		Name: "sys_tools_columns",
		Columns: []*Column{
			{Name: "column_id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
			{Name: "table_id", Type: DB_BigInt, Nullable: true},
			{Name: "column_name", Type: DB_NVarchar, Length: 128, Nullable: true},
			{Name: "column_comment", Type: DB_NVarchar, Length: 128, Nullable: true},
			{Name: "column_type", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "go_type", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "go_field", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "json_field", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "is_pk", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_increment", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_required", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_insert", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_edit", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_list", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "is_query", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "query_type", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "html_type", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "dict_type", Type: DB_NVarchar, Length: 4, Nullable: true},
			{Name: "sort", Type: DB_Int, Length: 4, Nullable: true},

			{Name: "is_configed", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "super_column", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "usable_column", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "increment", Type: DB_TinyInt, Length: 1, Nullable: true},
			{Name: "remark", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "fk_table_name", Type: DB_NVarchar, Length: 900, Nullable: true},
			{Name: "fk_table_name_class", Type: DB_NVarchar, Length: 900, Nullable: true},
			{Name: "fk_table_name_package", Type: DB_NVarchar, Length: 900, Nullable: true},
			{Name: "fk_label_id", Type: DB_NVarchar, Length: 255, Nullable: true},
			{Name: "fk_label_name", Type: DB_NVarchar, Length: 255, Nullable: true},

			{Name: "created_at", Type: DB_DateTime, Nullable: true},
			{Name: "updated_at", Type: DB_DateTime, Nullable: true},
			{Name: "deleted_at", Type: DB_DateTime, Nullable: true},
			{Name: "create_by", Type: DB_BigInt, Nullable: true},
			{Name: "update_by", Type: DB_BigInt, Nullable: true},
		},
	}

	//create table
	mg.AddMigration("create sys_tools_Column table", NewAddTableMigration(userV1))
}
